﻿namespace jQube.Web.UI.Controls
{
    using System;
    using System.Collections;
    using System.Collections.Generic;

    public class TriggerEnumerator : IEnumerator<Trigger>
    {
        private TriggerCollection TriggerCollection;
        private IEnumerator enumerator;

        private TriggerEnumerator()
        {
        }

        internal TriggerEnumerator(TriggerCollection TriggerCollection)
        {
            this.TriggerCollection = TriggerCollection;
            this.enumerator = TriggerCollection.List.GetEnumerator();
        }

        #region Miembros de IEnumerator<Trigger>

        Trigger IEnumerator<Trigger>.Current
        {
            get { return this.enumerator.Current as Trigger; }
        }

        #endregion

        #region Miembros de IDisposable

        void IDisposable.Dispose()
        {
            this.enumerator = null;
            this.TriggerCollection = null;
            GC.SuppressFinalize(this);
        }

        #endregion

        #region Miembros de IEnumerator

        object IEnumerator.Current
        {
            get { return this.enumerator.Current; }
        }

        bool IEnumerator.MoveNext()
        {
            return this.enumerator.MoveNext();
        }

        void IEnumerator.Reset()
        {
            this.enumerator.Reset();
        }

        #endregion
    }
}
